package com.mayflygeek.mayflyask.framework.core;

import java.util.Comparator;

/**
 * @author 虫虫
 * @team 蜉蝣极客
 * @link www.mayflygeek.com
 * @Emial chongchong@mayflygeek.com
 * 
 */
public class IdOrderComparator<T extends Idable<Long> & Orderable> implements Comparator<T> {

	@Override
	public int compare(T o1, T o2) {
		if(o1.getOrder() == o2.getOrder()) {
			return o1.getId().compareTo(o2.getId());
		}
		return (o1.getOrder() < o2.getOrder()) ? -1 : 1;
	}

}
